import request from '@/utils/request'

export function getRoles(params) {
  return request({
    url: `/roles`,
    params
  })
}

export function getRolesCount(params) {
  return request({
    url: `/roles/count`,
    params
  })
}

export function delRole(id) {
  return request({
    url: `/roles/${id}`,
    method: 'delete'
  })
}

export function addRole(data) {
  return request({
    url: `/roles`,
    method: 'post',
    data
  })
}

export function getRoleDetail(id) {
  return request({
    url: `/roles/${id}`
  })
}

export function updateRole(data) {
  return request({
    url: `/roles/${data.id}`,
    method: 'put',
    data
  })
}
